Skip to content

Conversation

@MaxBlack-dev
Copy link
Contributor

Description

Adds important documentation clarifying that custom configuration keys in .npmrc files should use hyphens instead of underscores to ensure they can be overridden by environment variables.

Changes

  • Added a note explaining the naming convention for .npmrc keys
  • Clarified that keys with underscores cannot be overridden by environment variables
  • Explained that npm converts underscores to hyphens when reading environment variables

Fixes

Closes #6036

Rationale

Users were confused because environment variables use underscores (npm_config_some_thing) but if you define 'some_thing' in .npmrc, it can't be overridden. This happens because npm converts underscores to hyphens when reading env vars, so the env var becomes 'some-thing' but the .npmrc key remains 'some_thing'. By using hyphens in .npmrc files, both will resolve to the same key.

Type of Change

  • Documentation update

@MaxBlack-dev MaxBlack-dev requested a review from a team as a code owner November 19, 2025 21:56
@MaxBlack-dev MaxBlack-dev force-pushed the docs/6036-npmrc-naming-convention branch from cd81093 to 5a75c16 Compare November 19, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOCS] npm config keys in .npmrc should not contain underscores

1 participant